<?php

/**
 * ECSHOP 文章
 * ============================================================================
 * 版权所有 2005-2010 上海商派网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.ecshop.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: liubo $
 * $Id: article.php 16455 2009-07-13 09:57:19Z liubo $
*/

define('IN_ECS', true);
define('ECS_ADMIN', true);

require(dirname(__FILE__) . '/includes/init.php');

$act = !empty($_GET['act']) ? $_GET['act'] : '';
//if ($_SESSION['user_id'] > 0)
//{
//	$smarty->assign('user_name', $_SESSION['user_name']);
//
//}
//if (!function_exists("htmlspecialchars_decode"))
//{
//	function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT)
//	{
//		return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
//	}
//}

/*文章列表请求*/

if (!empty($_GET['type'])){
 	$adv_type = !empty($_REQUEST['type']) ? intval($_REQUEST['type']) : 0;
	
	if ($adv_type)
	{
		$sql = " select action, action_id, action_param, url from " . $ecs->table('adv'); 
		$sql .= " WHERE adv_status = 1 AND position = ".$adv_type;
		$sql .= " ORDER BY sort_order desc ";
		$sql .= " limit 5";
	}
	$row = $GLOBALS['db']->getAll($sql);	
	foreach ($row as $k => $v)
	{
		//文章头图
		$v['url'] = OSS_HOST.$v['url'];
//		$article_array[$key]['ImageUrl'] = getSignedUrlForGettingObject($ossClient, $bucket, OSS_HOST,get_image_path($article_data['article_id'],$article_data['file_url'],false,'artile'));

		$row[$k] = $v;		
	}	

	echo json_encode($row);
}


?>